package com.liaoban.app.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.liaoban.app.R;
import com.liaoban.app.api.type.Follow;
import com.liaoban.app.helper.ImageHelper;
import com.liaoban.app.util.CommonUtils;

import java.util.List;

/**
 * Created by ybc on 2018/7/10 0010.
 * 我的关注
 */
public class FollowAdapter extends BaseQuickAdapter<Follow, BaseViewHolder> {

    public FollowAdapter(@Nullable List<Follow> data) {
        super(R.layout.item_follow, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Follow item) {
        ImageView ivIcon = helper.getView(R.id.iv_icon);
        ImageHelper.load(ivIcon, CommonUtils.getFullPic(item.getWuserSrc()));
        helper.setText(R.id.tv_name, item.getWuserName());
        switch (item.getStatus()) {
            case 0:
                helper.setGone(R.id.iv_follow, true);
                helper.setImageResource(R.id.iv_follow, R.mipmap.ic_follow_she);
                break;
            case 1:
                helper.setGone(R.id.iv_follow, true);
                helper.setImageResource(R.id.iv_follow, R.mipmap.ic_has_follow);
                break;
            case 2:
                helper.setGone(R.id.iv_follow, true);
                helper.setImageResource(R.id.iv_follow, R.mipmap.ic_fh);
                break;
            case 3:
                helper.setGone(R.id.iv_follow, false);
        }
        helper.addOnClickListener(R.id.iv_follow);
        /*if(1 == item.getStatus()) { //互相关注
            helper.setGone(R.id.tv_follow_fans, true);
            helper.setGone(R.id.tv_has_follow, false);
        } else {
            helper.setGone(R.id.tv_follow_fans, false);
            helper.setGone(R.id.tv_has_follow, true);
        }*/
    }
}
